# Embedding

from sentence_transformers import SentenceTransformer

def embedding(chunks: list[str]) -> list[list[float]]:
    model = SentenceTransformer("shibing624/text2vec-base-chinese")

    def text2vec(chunk: str) -> list[float]:
        vec = model.encode(chunk)
        return vec.tolist()

    data_embedding = [text2vec(chunk) for chunk in chunks]
    return data_embedding